@()(implicit session: Session)
@english.home.main("Literature") {

    <div id="content">
        <h1 class="title">Literature</h1>
        <div class="line"></div>


        <div id="toolbar"></div>

        <div class="table-contain">
            <table id="table" class="table table-hover  table-bordered table-striped" data-pagination="true" data-search="true"
            data-toolbar="#toolbar" data-search-align="left" data-page-list="[10]" data-page-size="10"
            data-multiple-search="true"
            style="border: 0px solid transparent;">
            </table>
        </div>

    </div>


    <script>


            $(".node").click(function () {
                console.log(1);
                console.log(this)
            })

            $(function () {

                $('#table').bootstrapTable({
                    columns: [
                        [{
                            field: "organism",
                            title: "Organism",
                            align: "center",
                            halign: "center",
                            valign: "middle",
                            formatter: (value, row) => {
                                return `<i>${row.organism}</i>`
                            }
                        }, {
                            field: "title",
                            title: "Title",
                            halign: "center",
                            valign: "middle",
                            formatter: function (value, row) {
                                if (row.pubmed.indexOf("http") == -1) {
                                    return "<a href='https://www.ncbi.nlm.nih.gov/pubmed/" + row.pubmed + "' target='_blank' >" + row.title + "</a>"
                                } else {
                                    return "<a href='" + row.pubmed + "'  target='_blank'>" + row.title + "</a>"
                                }
                            }
                        }, {
                            field: "journal",
                            title: "Journal",

                            halign: "center",
                            valign: "middle"
                        }, {
                            field: "authors",
                            title: "Authors",

                            halign: "center",
                            valign: "middle"
                        }
                        ]]
                });

                $.ajax({
                    url: "@routes.LiteratureController.getAllLiterature()",
                    type: "post",
                    success: function (data) {
                        $('#table').bootstrapTable("load", data);
                    }
                });

            })


    </script>


}